package Q1;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int t = scanner.nextInt();
        while (t > 0) {
            t--;
            int h = scanner.nextInt(); //自己血量
            int a = scanner.nextInt(); //自己攻击
            int H = scanner.nextInt(); //怪血量
            int A = scanner.nextInt(); //怪攻击力

            if (H == 0 || A == 0) { //可以杀死无数只怪
                System.out.println(-1);
            } else {
                int count = 0;
                int HH = H;
                while (h > 0) {
                    while (h > 0 && H > 0) {
                        h -= A;
                        H -= a;
                    }
                    if (h > 0) {
                        count++;
                        H = HH;
                    } else {
                        break;
                    }
                }
                System.out.println(count);
            }
        }
    }
}
